<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title><?php echo $store_name;?></title>
        <link href="/public/css/jscss.css" rel="stylesheet">
        <script type='text/javascript' src='/public/js/jquery-3.1.1.min.js'></script>
        <script src="/public/js/islider.js"></script>
        <script src="/public/js/islider_desktop.js"></script>
        <link href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
        <div style="padding-left:3rem">
            <div id="iSlider-effect-wrapper">
                <div id="non-looping" class="iSlider-effect"></div>
                <div class='img_number'><?php echo count($item['images']);?>图</div>
            </div>
        </div>
        <div style="clear:both"></div>
        <div class="content">
            <div>
                <span class='big_title'><?php echo $item['name'];?></span>&nbsp;&nbsp;&nbsp;&nbsp;
                <br><span class='small_title'><?php echo $item['title'];?></span>
            </div>
            <div class='cut_3'></div>
            <div class='cut'></div>
            <div class='cut_3'></div>
            <div>
                <?php if($item['is_meal_set']==1){ ?>
                <span class='_price'><s>原价：￥<?php echo $item['old_price']/100;?></s></span>
                <?php }?>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <span class='_price'>现价：￥<?php echo $item['price']/100;?></span>
                <?php if($score){ ?>
                <span class='_price' style='float:right;' >商品评分：<?php  echo $score;?>分</span>
                <?php } ?>
            </div>
            <div class='cut_3'></div>
            <div class='cut'></div>
            <div class='cut_3'></div>
            <?php if($item['is_meal_set']==1){ ?>
            <div class='set_content'>
            套餐内容：<br/>
            <?php foreach($item['items'] as $k=>$v){ ?>
            <a href="<?php echo shop_buildUrl('/user/shop/info?item_number='.$v['item_number']);?>" ><b><?php echo $v['name'];?></b></a>&nbsp;&nbsp;&nbsp;<?php echo $v['number'];?>&nbsp;个/次<br/>
            <?php }?>
            </div>
            <div class='cut_3'></div>
            <div class='cut'></div>
            <?php }?>
            <?php if($item['intro']){ ?>
            <div class='intro'>
                <?php echo $item['intro'];?>
                <div class='cut_3'></div>
                <div class='cut'></div>
            </div>
            <?php } ?>
            <?php if($evaluate){   ?>
                <div class='intro' >
                    <div>用户评价： <?php  if($evaluate['relpy'] != ''){ echo $evaluate['relpy']; }else{ echo $evaluate['content']; } ?></div>
                    <?php if($evaluate['evaluate_id']!=0 ){ ?>
                        <div>商家回复： <?php  echo $evaluate['content']; ?></div>
                    <?php } ?>
                    <div class='cut_3'></div>
                <div style='float:right;' ><a href="<?php echo shop_buildUrl("/user/evaluate/more_evaluate?start=0&item_number=$item[item_number]"); ?>">更多评价 >>> </a></div>
                </div>
                <div  class='cut_3' style='clear:both;'></div>
            <?php  }else{ ?>
              <div class='cut'></div>
              <div class='intro' >商品暂无评价！</div>  
            <?php  } ?>
            <div style='height:10rem'></div>
        </div>
        <div class='box navbar-fixed-bottom' style="text-align: center;">
            <button onclick='shopingcart();' class="btn btn-primary btn-lg" id='_fast' type="button" style="width:49%;background-color:#FF79BC;border-color:white;height:11rem;font-size: 4rem">我的购物车</button>
            <button onclick='_add();' class="btn btn-primary btn-lg" id='_add' type="button" style="width:49%;background-color:#FF79BC;border-color:white;height:11rem;font-size: 4rem">加入购物车</button>
        </div>
        <div class='_line'></div>
    </body>
    <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script>
                var picList = [
                        <?php foreach($item['images'] as $k => $v){ $image = explode('/',$v['image']);$_img = array_pop($image);$image = implode('/',$image).'/'.'max_'.$_img;?>
                {
                width: '100%',
                        height: '100%',
                        content: "http://<?php echo IMAGE_DOMAIN_.$image;?>"
                } <?php if ($k + 1 < count($item['images'])){echo ','; }?>
                        <?php } ?>
                ];
                //不循环 不自动播放
                var islider3 = new iSlider({
                data: picList,
                        dom: document.getElementById("non-looping"),
                        animateType: 'default',
                });
                islider3.bindMouse();
                function _add(){
                    var url = "<?php echo shop_buildUrl('/user/shop/addin?item_id='.$item['id']);?>";
                    $.ajax({
                        url: url,
                        async: true,
                        success: function (data) {
                            if (data == 'false') {
                                alert('操作失败，请稍候再试。');
                                return;
                            }
                            alert('商品已成功加入购物车');
                        }
                    });
                }
                function shopingcart(){
                    window.location.href = "<?php echo shop_buildUrl('/user/shop/shoppingcart');?>";
                }
                
<?php if($weixin == true){?>
    wx.config({
        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
        appId: '<?php echo WEIXIN_PAY_APP_ID;?>', // 必填，公众号的唯一标识
        timestamp: <?php echo $data["timestamp"];?>, // 必填，生成签名的时间戳
        nonceStr: '<?php echo $data["noncestr"];?>', // 必填，生成签名的随机串
        signature: '<?php echo $data["sign"];?>',// 必填，签名，见附录1
        jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
    });
    wx.ready(function () {
        wx.onMenuShareTimeline({
            title: '<?php echo $item['name'] ;?>', // 分享标题
            link: '<?php echo $data["url"];?>', // 分享链接
            imgUrl: '<?php echo "http://".MAIN_DOMAIN.$logo;?>', // 分享图标
            success: function () { 


            },
            cancel: function () { 
                // 用户取消分享后执行的回调函数

            }
        });
        wx.onMenuShareAppMessage({
            title: '<?php echo $item['name'] ;?>', // 分享标题
            desc: "<?php echo strip_tags($item['intro']);?>", // 分享描述
            link: '<?php echo $data["url"];?>', // 分享链接
            imgUrl: '<?php echo "http://".MAIN_DOMAIN.$item["images"][0];?>', // 分享图标
            type: '', // 分享类型,music、video或link，不填默认为link
            dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
            success: function () { 
                // 用户确认分享后执行的回调函数

            },
            cancel: function () { 
                // 用户取消分享后执行的回调函数

            }
        });
    })
<?php }?>
    </script>
</html>